<!DOCTYPE html>
<html>
  <head>
    <title>
      mediastreamaudiodestinationnode.html
    </title>
    <script src="../../resources/testharness.js"></script>
    <script src="../../resources/testharnessreport.js"></script>
    <script src="../resources/audit-util.js"></script>
    <script src="../resources/audit.js"></script>
  </head>
  <body>
    <script id="layout-test-code">
      let audit = Audit.createTaskRunner();

      audit.define(
          {
            label: 'test',
            description: 'Basic tests for MediaStreamAudioDestinationNode API'
          },
          (task, should) => {
            let context = new AudioContext();

            let mediaStreamDestination = context.createMediaStreamDestination();

            // MediaStreamAudioDestinationNode should inherit AudioNode.
            should(
                mediaStreamDestination instanceof AudioNode,
                'mediaStreamDestination instance')
                .beTrue();

            // Check the channel count boundary of 8.
            should(
                () => mediaStreamDestination.channelCount = 9,
                'Setting the channel count beyond 8')
                .throw(DOMException, 'NotSupportedError');

            // Check number of inputs and outputs.
            should(
                mediaStreamDestination.numberOfInputs,
                'mediaStreamDestination.numberOfInputs')
                .beEqualTo(1);

            // We should have no outputs
            should(mediaStreamDestination.numberOfOutputs, 'Number of outputs')
                .beEqualTo(0);

            // FIXME: add a test where we create a PeerConnection and call
            // addStream(mediaStreamDestination.stream).

            task.done();
          });

      audit.run();
    </script>
  </body>
</html>
